import { http } from "@/plugin/http";

// 获取box列表
export const getBoxList = async (params: API.BOX.BoxListParams) => {
  try {
    return await http.post<API.BOX.BoxListResponse>("/box/list", params);
  } catch (error) {
    return null;
  }
};

// 获取box详情
export const getBoxDetail = async (params: API.BOX.BoxDetailParams) => {
  try {
    return await http.post<API.BOX.BoxListItem>("/box/detail", params);
  } catch (error) {
    return null;
  }
};

// 模拟开启盒子
export const openSpinDemo = async (params: API.BOX.OpenBoxParams) => {
  try {
    return await http.post<API.BOX.OpenBoxResult>('/box/spin-demo', params)
  } catch (error) {
    return null;
  }
}

// 开启盒子
export const openSpin = async (params: API.BOX.OpenBoxParams) => {
  try {
    return await http.post<API.BOX.OpenBoxResult>('/box/spin', params)
  } catch (error) {
    return null;
  }
}
